<div id="sf_admin_container">
<?php if(isset($apartement)): ?>
<h1><?php echo $apartement->getName(); ?></h1>
<br/>
<br/>
<link rel='stylesheet' type='text/css' href='/js/fullcalendar-1.4.3/fullcalendar.css' />
<script type='text/javascript' src='/js/fullcalendar-1.4.3/jquery/jquery.js'></script>
<script type='text/javascript' src='/js/fullcalendar-1.4.3/jquery/ui.core.js'></script>
<script type='text/javascript' src='/js/fullcalendar-1.4.3/jquery/ui.draggable.js'></script>
<script type='text/javascript' src='/js/fullcalendar-1.4.3/jquery/ui.resizable.js'></script>
<script type='text/javascript' src='/js/fullcalendar-1.4.3/fullcalendar.min.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
	
		var date = new Date();
		var d = date.getDate();
		var m = date.getMonth();
		var y = date.getFullYear();
		
		$('#calendar').fullCalendar({
			header: {
				left: 'prev,next today',
				center: 'title',
				right: 'month,basicWeek,extWeek'
			},
			editable: true,
			events: [
                <?php 
                foreach($bookings as $b){
                    //echo $b->getCheckIn() . "<br>";
                    $cin = substr($b->getCheckIn(),0,strpos($b->getCheckIn()," "));
                    $ci = explode("-",$cin);
                    $cout =  substr($b->getCheckOut(),0,strpos($b->getCheckOut()," "));
                    $co = explode("-",$cout); 
                    $im = (int)$ci[1]-1;
                    $om = (int)$co[1]-1;
                    echo "\t\t\t{id:{$b->getId()}, title: 'F.szam:{$b->getBookingId()}, Nev: {$b->getLastName()}, Szemelyek: {$b->getPersons()}, Allapot: {$b->getBookingState()}  ', start: new Date({$ci[0]},{$im},{$ci[2]}), end: new Date({$co[0]},{$om},{$co[2]})}, \n";
                }
                ?>
			]
		});
		
	});

</script>
<style type='text/css'>
	#calendar {
		width: 800px;
		background-color: #fff;
		margin: 0 auto;
		}

</style>
<div id='calendar'></div>
<?php else: ?>
	Apartement doesn't exists
<?php endif; ?>
</div>